import { AppContainer, setConfig } from "react-hot-loader";

import React, { ReactElement } from "react";
import ReactDOM from "react-dom";
import { HashRouter as Router, Route } from "react-router-dom";

import { ConfigProvider, DatePicker, message } from "antd";
import zhCN from "antd/es/locale/zh_CN";

// 语法高亮
// import hljs from "highlight.js";

import "core-js/stable";
import "regenerator-runtime/runtime";
import Routes from "./router/index";
import MyLayout from "@components/MyLayout/index";
import "./style.scss";
import "github-markdown-css/github-markdown.css";

setConfig({ logLevel: "debug", showReactDomPatchNotification: false });
const Root = document.getElementById("root");
// window.hljs = hljs;
const render = () => {
  ReactDOM.render(
    <Router>
      <ConfigProvider locale={zhCN}>
        <MyLayout>
          <AppContainer>
            <Routes />
          </AppContainer>
        </MyLayout>
      </ConfigProvider>
    </Router>,
    Root
  );
};

render();

// Hot reloading
if (module.hot) {
  // Reload components
  module.hot.accept("./router/index", () => {
    render();
  });
}
